<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('查看用户信息')" />
    <style>
    * {font-size:14px;}
    .content-bg{padding:10px; background-color: #F2F2F2;}
    .layui-input{height:28px;font-size: 12px;}
    .layui-card-header{line-height: 42px;color: #fff;background:#d4f5f2;}
    .list-group-item {background-color: inherit;border-bottom: 1px solid #e7eaec;border-left:none;border-right:none;display: block;margin-bottom: -1px;padding: 10px 12px;position: relative;}
    .font-noraml {font-weight:400}
    .layui-form-label{width:108px;}
    .layui-input-block{margin-left:138px;}
    .layui-card-body{padding:10px 12px;}
    .font-noraml{font-size:13px;}
    td span{font-size:12px;}
    .layui-icon-more {position: absolute;right: 18px;top: 12px;cursor: pointer;}
    .layui-form-switch{margin-top:0;}
    .layui-form-radio {padding-right:5px;margin:0;}
    .layui-form-radio>i {font-size:16px;margin-right:2px;}
    </style>
</head>
<body>
<div class="content-bg">
	<div class="layui-row layui-col-space15">
	    <div style="width:326px;float:left;">
	    	<div class="layui-card">
	        <div class="layui-card-header">用户信息</div>
	        <div class="layui-card-body">
	        <form class="layui-form" id="form-user-add" lay-filter="form-user">
	        <input type="hidden" name="userId"  th:value="${sysUserInfo?.userId}">
	        	<ul>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-user"></i>
			            <b class="font-noraml">用户编号：</b>
			            <p class="pull-right">[[${sysUserInfo?.userId}]]</p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-credit-card"></i>
			            <b class="font-noraml">用户名称：</b>
			            <p class="pull-right"><input style="width:180px;float: right;" type="text" name="userName" th:value="${sysUserInfo?.userName}" autocomplete="off" class="layui-input"></p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-tb-hr-c"></i>
			            <b class="font-noraml">用户类型：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;">
			            <select name="userType" id="userType" lay-filter="userType" th:with="type=${@baseinfosimple.getBaseInfoSimpleData('yhlx')}">
		        		<option value="">请选择</option>
						<option th:each="dict : ${type}" th:text="${dict.vname}" th:data-guid="${dict.guid}" th:value="${dict.vid}" th:selected="${dict.vid} eq ${sysUserInfo?.userType}"></option>
				      	</select></div>
				      	</p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-shield"></i>
			            <b class="font-noraml">用户状态：</b>
			            <p class="pull-right">
			            <input type="checkbox" th:checked="${sysUserInfo?.disabled == false or sysUserInfo?.disabled == null}" name="disabled" lay-skin="switch" lay-text="启用|禁用"></p>
		        	</li>
		        	<li class="list-group-item" style="height:auto;zoom:1;overflow:hidden;">
		        		<i class="dhicon dh-female"></i>
			            <b class="font-noraml">员工状态：</b>
			            <p class="pull-right" style="width:160px;" th:with="type=${@baseinfosimple.getBaseInfoSimpleData('ygzt')}">
							<input th:each="dict : ${type}" type="radio" name="userState" th:value="${dict.vname}" th:title="${dict.vname}" th:checked="${dict.vname} eq ${sysUserInfo?.userState}">
      					</p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-transgender-alt"></i>
			            <b class="font-noraml">性别：</b>
			            <p class="pull-right">
						<input type="radio" name="userSex" value="男" title="男" th:checked="'男' eq ${sysUserInfo?.userSex}">
      					<input type="radio" name="userSex" value="女" title="女" th:checked="'女' eq ${sysUserInfo?.userSex}">
      					<input type="radio" name="userSex" value="其它" title="其它" th:checked="'其它' eq ${sysUserInfo?.userSex}">
      					</p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-street-view"></i>
			            <b class="font-noraml">用户级别：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;"><select name="userLevel">
					        <option value="">请选择用户级别</option>
					        <option th:each="userLevelList:${userLevelMap}" th:value="${userLevelList.key}" th:text="${userLevelList.value}" th:selected="${userLevelList.key} eq ${sysUserInfo?.userLevel}"></option>
				      	</select></div></p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-bullseye"></i>
			            <b class="font-noraml">主角色：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;">
			            <input type="text" name="positionName" id="positionName" th:value="${sysUserInfo?.positionName}" autocomplete="off" class="layui-input" readonly/>
			            <input type="hidden" name="positionGuid" id="positionGuid" th:value="${sysUserInfo?.positionGuid}">
	      				<i class="layui-icon layui-icon-more" onclick="modalSelect('positionName')"></i></div>
			            </p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-star"></i>
			            <b class="font-noraml">直属上级：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;"><input type="text" name="userLeader" id="userLeader" th:value="${sysUserInfo?.userLeader}" autocomplete="off" class="layui-input" readonly/>
	      				<i class="layui-icon layui-icon-more" onclick="modalSelect('userLeader')"></i></div>
			            </p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-group"></i>
			            <b class="font-noraml">所属部门：</b>
			            <p class="pull-right">[[${sysUserInfo?.deptName}]]</p>
		        	</li>
					<li class="list-group-item" style="padding: 0 12px;height: 44px;">
						<p style="padding: 10px 0;float: left;">
							<i class="dhicon dh-sitemap"></i>
							<b class="font-noraml">所属公司名称：</b>
						</p>
						<p class="pull-right" style="width:170px;height:44px;text-align:right;vertical-align:middle;display:table-cell;float: inherit">[[${sysUserInfo?.cidName}]]</p>
					</li>
					<li class="list-group-item">
						<i class="dhicon dh-phone"></i>
						<b class="font-noraml">办公电话：</b>
						<p class="pull-right"><input style="width:180px;float: right;" type="text" name="userPhone1" th:value="${sysUserInfo?.userPhone1}" autocomplete="off" class="layui-input"></p>
					</li>
					<li class="list-group-item" style="padding-left: 0"><font class="f_red" style="margin-right: 0">*</font>
						<i class="dhicon dh-phone"></i>
						<b class="font-noraml">手机号码：</b>
						<p class="pull-right"><input style="width:180px;float: right;" type="text" name="userPhone2" th:value="${sysUserInfo?.userPhone2}" autocomplete="off" lay-verify="required" class="layui-input"></p>
					</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-magnet"></i>
			            <b class="font-noraml">工作省份：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;">
			            <select name="userProvince" id="userProvince" lay-filter="userProvince" th:with="type=${@baseinfosimple.getBaseInfoSimpleData('area2')}">
		        		<option value="">请选择</option>
						<option th:each="dict : ${type}" th:text="${dict.vname}" th:data-guid="${dict.guid}" th:value="${dict.vid}" th:selected="${dict.vid} eq ${sysUserInfo?.userProvince}"></option>
				      	</select></div>
				      	</p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-university"></i>
			            <b class="font-noraml">工作城市：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;"><select name="userCity" id="userCity" lay-filter="userCity"></select></div></p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-tb-home-c"></i>
			            <b class="font-noraml">所属办公室：</b>
			            <p class="pull-right">
			            <div style="width:160px;float: right;">
			            <select name="vBgs" id="vBgs" lay-filter="vBgs" th:with="type=${@baseinfosimple.getBaseInfoSimpleData('bgs')}">
		        		<option value="">请选择</option>
						<option th:each="dict : ${type}" th:text="${dict.vname}" th:data-guid="${dict.guid}" th:value="${dict.vid}" th:selected="${dict.vid} eq ${sysUserInfo?.vBgs}"></option>
				      	</select></div>
				      	</p>
		        	</li>
		        	<li class="list-group-item">
		        		<i class="dhicon dh-neuter"></i>
			            <b class="font-noraml">工作地址：</b>
			            <p class="pull-right"><input style="width:180px;float: right;" type="text" name="userAddress" id="userAddress" th:value="${sysUserInfo?.userAddress}" autocomplete="off" class="layui-input"></p>
		        	</li>
	        	</ul>
	        	<div class="layui-form-item" style="text-align: center;margin-bottom: 0;">
		            <div class="layui-input-block" style="margin:0;">
		                <button class="layui-btn" lay-submit lay-filter="btn-add">保存</button>
		            </div>
		        </div>
	        	</form>
	        </div>
	      </div>
	      <div class="layui-card">
	        <div class="layui-card-header">当前档案相关账号列表</div>
	        <div class="layui-card-body">
        		<table class="layui-table" lay-size="sm">
				    <tbody class="userList">
			    	  <tr>
				        <td>序号</td>
				        <td class="text_c">用户编号</td>
				        <td class="text_c">用户名</td>
				      </tr>
			      	</tbody>
		    	</table>
	        </div>
	      </div>
	    </div>
	    <div style="width:calc(100% - 356px);float:left;">
	    	<div class="layui-card">
	        	<div class="layui-card-header">档案信息
	                <span th:if="${buttonState['tp-add']} neq 'hidden'" 
	                th:class="${buttonState['tp-add']} eq 'enable'?'layui-btn layui-btn-sm layui-btn-normal f_r addDaxx':'layui-btn layui-btn-sm f_r layui-btn-disabled'" style="margin-top: 7px;margin-left: 10px;">新增档案</span>
	                <button th:if="${sysUserInfo?.daNid ne NULL} and ${buttonState['tp-add']} neq 'hidden'" 
	                th:class="${buttonState['tp-add']} eq 'enable'?'layui-btn layui-btn-sm layui-btn-warm f_r editDaxx':'layui-btn layui-btn-sm f_r layui-btn-disabled'" style="margin-top: 7px;">修改档案</button>
	                <button th:if="${buttonState['relatebtn']} neq 'hidden'" 
	                th:class="${buttonState['relatebtn']} eq 'enable'?'layui-btn layui-btn-sm layui-btn-danger f_r relateDaxx':'layui-btn layui-btn-sm f_r layui-btn-disabled'" style="margin-top: 7px;">关联档案</button>
               	</div>
	        	<div class="layui-card-body" style="padding-right: 20px;">
		        	<table class="layui-table" lay-size="sm">
				    <tbody>
						<tr>
							<td colspan="8" style="background-color: #99cffd;height: 30px;font-weight: 700;text-align: center;color: #fff;font-size: 16px;">基础信息</td>
						</tr>
			    	    <!-- <tr>
				          <td class="table-title" width="165px">岗位</td>
				          <td width="150px">[[${personnelDAXX?.vGw}]]</td>
				          <td class="table-title" width="105px">所属办公室</td>
				          <td>[[${personnelDAXX?.vBgs}]]</td>
				          <td class="table-title" width="105px">入职日期</td>
				          <td colspan="2">[[${#dates.format(personnelDAXX?.dRzRq,'yyyy-MM-dd')}]]</td>
				        </tr> -->
			    	    <tr>
				          <td class="table-title">姓名</td>
				          <td>[[${personnelDAXX?.userName}]]</td>
				          <td class="table-title">性别</td>
				          <td>[[${personnelDAXX?.userSex}]]</td>
				          <td class="table-title">出生年月</td>
				          <td>[[${#dates.format(personnelDAXX?.dCsRq,'yyyy-MM-dd')}]]</td>
				          <td rowspan="4" width="100px;" style="text-align: center;cursor: pointer;" class="userPhoto">
				          <img th:if="${personnelDAXX?.userPhoto ne ''}" th:src="${personnelDAXX?.userPhoto}">
				          <span th:if="${personnelDAXX?.userPhoto eq ''}">暂无照片</span>
				          </td>
				        </tr>
				        <tr>
				          <td class="table-title">婚姻情况</td>
				          <td>[[${personnelDAXX?.vHyQk}]]</td>
				          <td class="table-title">籍贯</td>
				          <td>[[${personnelDAXX?.userProvince}]] <span th:if="${personnelDAXX?.userProvince ne ''}">省</span>[[${personnelDAXX?.userCity}]] <span th:if="${personnelDAXX?.userCity ne ''}">市</span>
				          </td>
				          <td class="table-title">政治面貌</td>
				          <td>[[${personnelDAXX?.vZzMm}]]</td>
				        </tr>
				        <tr>
				          <td class="table-title">毕业院校</td>
				          <td>[[${personnelDAXX?.vByYx}]]</td>
				          <td class="table-title">专业</td>
				          <td>[[${personnelDAXX?.vZy}]]</td>
				          <td class="table-title">学历</td>
				          <td>[[${personnelDAXX?.vXl}]]</td>
				        </tr>
				        <tr>
				          <td class="table-title">身份证号码</td>
				          <td>[[${personnelDAXX?.vSfzHm}]]</td>
				          <td class="table-title">电子邮箱</td>
				          <td>[[${personnelDAXX?.userMail}]]</td>
				          <td class="table-title">手机号码</td>
				          <td>[[${personnelDAXX?.userPhone1}]]</td>
				        </tr>
				        <tr>
				          <td class="table-title">户口性质</td>
				          <td>[[${personnelDAXX?.vHkXz}]]</td>
				          <td class="table-title">转正日期</td>
				          <td>[[${#dates.format(personnelDAXX?.dZzRq,'yyyy-MM-dd')}]]</td>
				          <td class="table-title">毕业年份</td>
				          <td colspan="2">[[${personnelDAXX?.vByNf}]]</td>
				        </tr>
				        <tr>
				          <td class="table-title">户籍地址</td>
				          <td colspan="3">[[${personnelDAXX?.vHjDz}]]</td>
				          <td class="table-title">计算机等级</td>
				          <td colspan="2">[[${personnelDAXX?.vZcZs}]]</td>
				        </tr>
				        <tr>
				          <td class="table-title">家庭住址</td>
				          <td colspan="3">[[${personnelDAXX?.vJtZz}]]</td>
				          <td class="table-title">外语等级</td>
				          <td colspan="2">[[${personnelDAXX?.vWyZs}]]</td>
				        </tr>
						<tr>
						  <td class="table-title">自我评价</td>
						  <td colspan="3">[[${personnelDAXX?.vZwPj}]]</td>
				          <td class="table-title">其他证书</td>
				          <td colspan="2">[[${personnelDAXX?.vWyZsQt}]]</td>
						</tr>
				        <tr>
				          <td class="table-title" rowspan="4">学校荣誉</td>
				          <td class="text_c table-title" colspan="2">获得时间</td>
				          <td class="text_c table-title" colspan="2">学校</td>
				          <td class="text_c table-title">职位/荣誉</td>
				          <td class="text_c table-title">具体内容</td>
				          <!-- <td class="text_c table-title">就学形式</td> -->
				        </tr>
				        <tr>
				        	<td colspan="2"><span class="dRxSj0"></span>~<span class="dBySj0"></span></td>
				            <td colspan="2"><span class="vXx0"></span></td>
				            <td><span class="vXl0"></span></td>
				            <td><span class="vZy0"></span></td>
				            <!-- <td><span class="vJxXs0"></span></td> -->
				        </tr>
				        <tr>
				        	<td colspan="2"><span class="dRxSj1"></span>~<span class="dBySj1"></span></td>
				            <td colspan="2"><span class="vXx1"></span></td>
				            <td><span class="vXl1"></span></td>
				            <td><span class="vZy1"></span></td>
				            <!-- <td><span class="vJxXs1"></span></td> -->
				        </tr>
				        <tr>
				        	<td colspan="2"><span class="dRxSj2"></span>~<span class="dBySj2"></span></td>
				            <td colspan="2"><span class="vXx2"></span></td>
				            <td><span class="vXl2"></span></td>
				            <td><span class="vZy2"></span></td>
				            <!-- <td><span class="vJxXs2"></span></td> -->
				        </tr>
				        <tr>
				          <td class="table-title" rowspan="4">工作履历</td>
				          <td class="text_c table-title">工作时间</td>
				          <td class="text_c table-title" colspan="2">所在单位</td>
				          <td class="text_c table-title">职务</td>
				          <td class="text_c table-title">离职原因</td>
				          <td class="text_c table-title">主要工作业绩</td>
				        </tr>
				        <tr>
				        	<td>
				        		<span class="dRzSj0"></span>~<span class="dLzSj0"></span>
			      		</td>
				          <td colspan="2"><span class="vDw0"></span></td>
				          <td><span class="vZw0"></span></td>
				          <td><span class="vLzYy0"></span></td>
				          <td><span class="vGzYj0"></span></td>
				        </tr>
				        <tr>
				        	<td>
				        		<span class="dRzSj1"></span>~<span class="dLzSj1"></span>
			      		</td>
				          <td colspan="2"><span class="vDw1"></span></td>
				          <td><span class="vZw1"></span></td>
				          <td><span class="vLzYy1"></span></td>
				          <td><span class="vGzYj1"></span></td>
				        </tr>
				        <tr>
				        	<td>
				        		<span class="dRzSj2"></span>~<span class="dLzSj2"></span>
			      		</td>
				          <td colspan="2"><span class="vDw2"></span></td>
				          <td><span class="vZw2"></span></td>
				          <td><span class="vLzYy2"></span></td>
				          <td><span class="vGzYj2"></span></td>
				        </tr>
				        <tr>
				          <td class="table-title" rowspan="2">有无子女</td>
				          <td rowspan="2" colspan="2">[[${personnelDAXX?.vYwZn}]]</td>
				          <td class="table-title" colspan="2">子女1出生年月</td>
				          <td colspan="3">[[${#dates.format(personnelDAXX?.dZnCsRq1,'yyyy-MM-dd')}]]</td>
				        </tr>
				        <tr>
				        	<td class="table-title" colspan="2">子女2出生年月</td>
				          <td colspan="3">[[${#dates.format(personnelDAXX?.dZnCsRq2,'yyyy-MM-dd')}]]</td>
				        </tr>
				        <tr>
				          <td class="table-title">紧急联系人</td>
				          <td>[[${personnelDAXX?.vLxrXm}]]</td>
				          <td class="table-title">关系</td>
				          <td>[[${personnelDAXX?.vLxrGx}]]</td>
				          <td class="table-title">联系电话</td>
				          <td colspan="2">[[${personnelDAXX?.vLxrDh}]]</td>
				        </tr>
						<tr>
							<td colspan="8" style="background-color: #99cffd;height: 30px;font-weight: 700;text-align: center;color: #fff;font-size: 16px;">求职意向</td>
						</tr>
						<tr>
				          <td class="table-title" width="165px">岗位</td>
				          <td width="150px">[[${personnelDAXX?.vGw}]]</td>
				          <td class="table-title" width="105px">意向城市</td>
				          <td>[[${personnelDAXX?.vYxCs}]]</td>
				          <td class="table-title" width="105px">所属办公室</td>
				          <td colspan="2">[[${personnelDAXX?.vBgs}]]</td>
				        </tr>
						<tr>
							<td class="table-title" width="165px">期望薪资</td>
							<td width="150px">[[${personnelDAXX?.vQwXz}]]</td>
							<td class="table-title" width="105px">入职日期</td>
							<td>[[${#dates.format(personnelDAXX?.dRzRq,'yyyy-MM-dd')}]]</td>
							<td colspan="4"></td>
						</tr>
				      </tbody>
				  </table>
		        </div>
	     	</div>
	    </div>
	</div>
</div> 
<th:block th:include="include :: footer" />
<th:block th:include="include :: motif-alone" />
<script th:inline="javascript">
/*<![CDATA[*/
var userProvince = [[${sysUserInfo?.userProvince}]];
var userCity = [[${sysUserInfo?.userCity}]]
var personnelDAJYJLList = [[${personnelDAJYJLList}]];
var personnelDAGZJLList = [[${personnelDAGZJLList}]];
var relevantDAUserList = [[${relevantDAUserList}]];
/*]]>*/
</script>
<script type="text/javascript">
$(".content-bg").css("min-height",$(window).height()-20);
var jyjlObj = ['dRxSj','dBySj','vXx','vXl','vZy','vJxXs'], gzjlObj = ['dRzSj','dLzSj','vDw','vZw','vLzYy','vGzYj'];
/*用户管理-头像*/
function avatar() {
    var url = ctx + 'system/user/avatar?userId=[[${sysUserInfo?.userId}]]';
    $.modal.open('修改头像',url,'800','600',function(index){
        var res = window["layui-layer-iframe" + index].updateAvatar();
    });
}
layui.use(['laydate', 'form','layer','jquery'], function () {
	var $ = layui.$,layer = layui.layer,form = layui.form,laydate = layui.laydate,postStr = [];
	//获取省份列表
	$(function(){
		var cProvince = $("[name=userProvince]").find("option:selected").attr("data-guid");
		if(cProvince){
			$.ajax({
				url: '/base/baseinfo/list?pguid='+cProvince,
		        type: 'get',
		        dataType: 'json',
				success: function(result) {
					$('#userCity').append(new Option('请选择城市',''));
					$.each(result.data,function(i,v){
						if(v.vname == userCity){
							$('#userCity').append('<option value="'+v.vid+'" data-guid="'+v.guid+'" selected>'+v.vname+'</option>')
						}else{
							$('#userCity').append('<option value="'+v.vid+'" data-guid="'+v.guid+'">'+v.vname+'</option>')
						}
		        	});
					form.render();
				}
			});
		}
	})

	//切换所属办公室
	form.on('select(vBgs)', function(e) {
        $.ajax({
            type: "GET",
            url: '/base/baseinfo/list?vname='+e.value,
            success: function (res) {
				$('#userAddress').val(res.data[0].vremark)
            }
        })
    })
	//联动获取城市列表
	form.on('select(userProvince)', function(data){
    	var pguid = data.elem[data.elem.selectedIndex].dataset.guid;
    	getCity(pguid);
	})
	function getCity(pguid,cityname){
		$.ajax({
			url: '/base/baseinfo/list?pguid='+pguid,
	        type: 'get',
	        dataType: 'json',
	        success: function(result) {
	        	var areaList = '<option value="">请选择城市</option>';
	        	$.each(result.data,function(k,v){
	        		if(cityname == v.vname){
	        			areaList += '<option value="'+v.vname+'" data-guid="'+v.pguid+'" selected>'+v.vname+'</option>';
	        		}else{
	        			areaList += '<option value="'+v.vname+'" data-guid="'+v.pguid+'">'+v.vname+'</option>';
	        		}
	        	});
	        	$("#userCity").empty();
	        	$("#userCity").append(areaList);
	        	form.render('select');
	        }
		})
	}
	form.on('submit(btn-add)', function(data){
		data.field.disabled = data.field.disabled === "on" ? "0":"1";
		var mobile=/^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
		var tel = /^(0\d{2,3}-)?\d{7,8}$/g;
		if(data.field.userPhone1 !="" && tel.test(data.field.userPhone1) == false) {
			$.modal.msgError("办公电话格式不对！");
			return false;
		}
		if(data.field.userPhone2 !="" && mobile.test(data.field.userPhone2) == false) {
			$.modal.msgError("手机号码格式不对！");
			return false;
		}
		postStr.push(data.field);
        //TODO:提供一个检测表单数据检测性通用方法
        if(true){
       		var url = "/system/user/editpost";
       		var data = {'userInfoItems':JSON.stringify(postStr),'upType':'upuser'};
        	$.operate.post(url,data,function(result){
        		setTimeout(function(){
                    window.location.reload();
                }, 1000);
        	});
        }
        return false;
     });

})
//查看赋值
$.each(personnelDAJYJLList,function(i, v){
	$.each(jyjlObj,function(i2, v2){
		$("."+v2+i).html(v[v2]);
	})
})
$.each(personnelDAGZJLList,function(i, v){
	$.each(gzjlObj,function(i2, v2){
		$("."+v2+i).html(v[v2]);
	})
})
var userListStr = ""
$.each(relevantDAUserList,function(i, v){
	userListStr += '<tr><td class="text_c">'+(i+1)+'</td><td class="text_c">'+v.userId+'</td><td class="text_c">'+v.userName+'</td></tr>'
})
$(".userList").append(userListStr);
function modalSelect(forField){
	switch(forField){
		case 'userLeader':
			var title = "选择上级", url = "/system/user/userselect?pagetype=radio", mWidth = "600", mheight = "470";
			break;
		case 'daXX':
			var title = "选择档案", url = "/hr/personneldaxx/select", mWidth = "800", mheight = "500";
			break;
		case 'positionName':
			var title = "选择主角色", url = "/system/role/select?pagetype=radio", mWidth = "500", mheight = "460";
			break;
	}
 	$.modal.open(title,url,mWidth,mheight,function(index){
    	var res = window["layui-layer-iframe" + index].callbackdata();
    	if(!!res){
	    	switch(forField){
	        	case 'userLeader':
	        		$("#userLeader").val(res.userId);
	        		break;
	        	case 'daXX':
	           		var data = {'infoItems':JSON.stringify([{userId:$("[name='userId']").val(),daNid:res.nid}])};
	           		console.log(data)
		           	$.operate.post("/system/user/relevantda",data,function(result){
		           		setTimeout(function(){
		                       if(result.code==0)window.location.reload();
	                    }, 1000);
		           	});
	        		break;
	        	case 'positionName':
	        		$("#positionName").val(res.roleName);
	        		$("#positionGuid").val(res.guid);
	        		break;
	    	}
       	 	layer.closeAll();
         }else{
             layer.msg("请选择人员！");
         }
	})
}
$(".addDaxx").click(function(){
	parent.layui.index.openTabsPage("hr/personneldaxx/edit?nid=0", '档案信息 - 新增');
})
$(".editDaxx").click(function(){
	parent.layui.index.openTabsPage("hr/personneldaxx/edit?nid=[[${sysUserInfo?.daNid}]]", '档案信息-编辑');
})
$(".relateDaxx").click(function(){
	modalSelect('daXX')
})
</script>
</body>
</html>